# !/usr/bin/env python
# -*- coding: utf-8 -*-

import threading
import time


# 自定义线程类
class MyThread(threading.Thread):
    def __init__(self, num):
        super().__init__()  # 要先调用父类的init方法否则会报错
        self.num = num

    # 重写 父类run方法
    def run(self):
        for i in range(self.num):
            print("正在执行子线程的run方法...", i)
            time.sleep(0.5)


if __name__ == '__main__':
    thread = MyThread(5)
    thread.start()
